-- Test sys.xp_instance_regread --

-- Test string parameters with int return type
DECLARE @retVal INT
EXECUTE xp_instance_regread N'RootKey', N'Key', N'ServiceName', @retVal OUT
SELECT @retVal;
GO

-- Test string parameters with nvarchar return type
DECLARE @retVal nvarchar(512)
EXECUTE sys.xp_instance_regread N'RootKey', N'Key', N'ServiceName', @retVal OUT
SELECT @retVal;
GO

-- Test string variables with int return type
DECLARE @param1 NVARCHAR(512)
DECLARE @param2 NVARCHAR(512)
DECLARE @param3 NVARCHAR(512)
SET @param1 = N'RootKey'
SET @param2 = N'Key'
SET @param3 = N'ServiceName'
DECLARE @retVal INT

EXECUTE sys.xp_instance_regread @param1, @param2, @param3, @retVal OUT
SELECT @retVal;
GO

-- Test string parameters with nvarchar return type
DECLARE @param1 NVARCHAR(512)
DECLARE @param2 NVARCHAR(512)
DECLARE @param3 NVARCHAR(512)
SET @param1 = N'RootKey'
SET @param2 = N'Key'
SET @param3 = N'ServiceName'
DECLARE @retVal nvarchar(512)

EXECUTE xp_instance_regread @param1, @param2, @param3, @retVal OUT
SELECT @retVal;
GO

USE master
GO

-- Test master.dbo.xp_instance_regread --

-- Test string parameters with int return type
DECLARE @retVal INT
EXECUTE dbo.xp_instance_regread N'RootKey', N'Key', N'ServiceName', @retVal OUT
SELECT @retVal;
GO

-- Test string parameters with nvarchar return type
DECLARE @retVal nvarchar(512)
EXECUTE master.dbo.xp_instance_regread N'RootKey', N'Key', N'ServiceName', @retVal OUT
SELECT @retVal;
GO

-- Test string variables with int return type
DECLARE @param1 NVARCHAR(512)
DECLARE @param2 NVARCHAR(512)
DECLARE @param3 NVARCHAR(512)
SET @param1 = N'RootKey'
SET @param2 = N'Key'
SET @param3 = N'ServiceName'
DECLARE @retVal INT

EXECUTE master.dbo.xp_instance_regread @param1, @param2, @param3, @retVal OUT
SELECT @retVal;
GO

-- Test string parameters with nvarchar return type
DECLARE @param1 NVARCHAR(512)
DECLARE @param2 NVARCHAR(512)
DECLARE @param3 NVARCHAR(512)
SET @param1 = N'RootKey'
SET @param2 = N'Key'
SET @param3 = N'ServiceName'
DECLARE @retVal nvarchar(512)

EXECUTE dbo.xp_instance_regread @param1, @param2, @param3, @retVal OUT
SELECT @retVal;
GO